package com.javaAPI.demo7;

public class Test4 {
    public static void main(String[] args) {
        String str = "武汉|长沙|北京|兰州";

        //通过|来进行分割字符串，返回数组
        //需要加入反斜杠 * |
        String[] split = str.split("\\|");
        for (String s : split) {
            System.out.println(s);
        }

    }
}
